package com.learn.xueer.ui.activity

import android.os.Bundle
import com.learn.xueer.app.base.BaseActivity
import com.learn.xueer.databinding.ActivityStudyHistoryBinding
import com.learn.xueer.ui.adapter.StudyHistoryAdapter
import com.learn.xueer.ui.viewmodel.MineViewModel
import kotlinx.android.synthetic.main.activity_study_history.rv

/**
 * 学习记录
 */
class StudyHistoryActivity : BaseActivity<MineViewModel, ActivityStudyHistoryBinding>() {

    private val adapter: StudyHistoryAdapter by lazy { StudyHistoryAdapter(arrayListOf()) }

    inner class ProxyClick {
        fun back() {
            finish()
        }

    }

    override fun initView(savedInstanceState: Bundle?) {
        mDatabind.click = ProxyClick()
        mDatabind.viewmodel = mViewModel
        rv.adapter = adapter

        showLoading()
        mViewModel.studyHistory({
            dismissLoading()
            adapter.setList(it)
        }, {
            dismissLoading()
        })
//        CacheDataManager.clearAllCache(this@ClearCacheActivity)
//        ToastUtils.showShort("清除缓存成功")
    }
}